<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
    <!ENTITY nbsp "&#xA0;">
    <!ENTITY nl "&#xD;&#xA;">
]>

<!-- stylesheet for mimetype "application/vnd.oasis.opendocument.spreadsheet" -->

<!-- Version and namespaces -->
<xsl:stylesheet version="1.0"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
    xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
    xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
    xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
    xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
    xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
    xmlns:int="http://opendocumentfellowship.org/internal"
    xmlns:math="http://www.w3.org/1998/Math/MathML"
    xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
    xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
    xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
    xmlns:ooo="http://openoffice.org/2004/office"
    xmlns:oooc="http://openoffice.org/2004/calc"
    xmlns:ooow="http://openoffice.org/2004/writer"
    xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
    xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
    xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
    xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
    xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
    xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
    xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    exclude-result-prefixes="anim chart config dc dr3d draw fo form int math meta number
        office ooo oooc ooow presentation script smil style svg table text xforms xlink #default">

<!-- - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = -->

    <!-- import the base stylesheet -->
    <xsl:import href="common.xsl" /> <!-- use import because we need to override the table:table template -->

    <!-- import the stylesheet for text and spreadsheet common templates -->
    <xsl:import href="text.spreadsheet.xsl" />

    <!-- define the mimetype for this document -->
    <xsl:variable name="mimetype">application/vnd.oasis.opendocument.spreadsheet</xsl:variable>

<!-- - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = -->

<!-- SPREADSHEET-SPECIFIC templates -->

    <xsl:template name="ods-js">
        <xsl:element name="script">
            <xsl:attribute name="type"><xsl:text>application/javascript</xsl:text></xsl:attribute>
            <xsl:text>
    function hideAll() {
        var pages = document.getElementsByName('spreadSheet');
        var links = document.getElementsByName('sheetlink');
        for (i=0, j=1; i != pages.length; i++, j++) {
            pages[i].style.display = 'none';
            links[i].style.color = 'blue';
            links[i].style.textDecoration = 'underline';
        }
    }
    function showPage(sheetName) {
        if (sheetName == "") {
            // if input is blank, display the first sheet by default
            var pages = document.getElementsByName('spreadSheet');
            sheetName = pages[0].id;
        }
        hideAll();
        document.getElementById(sheetName).style.display = '';
        var selectedLink = "link" + sheetName;
        document.getElementById(selectedLink).style.color = 'black';
        document.getElementById(selectedLink).style.textDecoration = 'none';
    }
            </xsl:text>
        </xsl:element>
    </xsl:template>

    <!-- spreadsheet comments will be displayed similar to a tooltip -->
    <xsl:template match="office:annotation">
        <xsl:element name="div">
            <xsl:attribute name="class">
                <xsl:text>tooltipContents </xsl:text>
                <xsl:call-template name="callClassInheritance">
                    <xsl:with-param name="paramValue"><xsl:value-of select="@draw:style-name" /></xsl:with-param>
                </xsl:call-template>
                <xsl:text> </xsl:text>
                <xsl:call-template name="callClassInheritance">
                    <xsl:with-param name="paramValue"><xsl:value-of select="@draw:text-style-name" /></xsl:with-param>
                </xsl:call-template>
            </xsl:attribute>
            <xsl:attribute name="style">
                <xsl:if test="@svg:width">width: <xsl:value-of select="@svg:width" />; </xsl:if>
                <xsl:if test="@svg:height">height: <xsl:value-of select="@svg:height" />; </xsl:if>
            </xsl:attribute>
            <xsl:apply-templates />
        </xsl:element>
        <!-- when a "comment" exists, indicate its existence by a red ^ symbol at the upper right corner of the cell -->
        <span class="toolTipMarker"><xsl:text>^</xsl:text></span>
    </xsl:template>

    <xsl:template match="dc:creator|dc:date|meta:date-string">
        <!-- do not display contents, since by default, these annotation items are also not displayed to user -->
    </xsl:template>

<!-- - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = -->

</xsl:stylesheet>
